network:
  version: 2
  renderer: networkd
  ethernets:
    {{ network_config.main_bridge.interfaces[0] }}:
      dhcp4: no

  bridges:
    # 主网桥配置
    {{ network_config.main_bridge.name }}:
      interfaces: [{{ network_config.main_bridge.interfaces[0] }}]
      addresses: [{{ network_config.main_bridge.address }}]
      routes:
        - to: default
          via: {{ network_config.main_bridge.gateway }}
      nameservers:
        addresses: 
          - {{ network_config.main_bridge.gateway }}
      parameters:
        stp: {{ network_config.main_bridge.stp | lower }}
        forward-delay: 0
      mtu: {{ network_config.main_bridge.mtu }}


    # 地域和可用区网桥配置
{% for region in network_config.regions.values() %}{% for az in region.azs.values() %}
    {{ az.bridge }}:
      interfaces: []
      addresses: ["{{ az.gateway }}/24"]
      parameters:
        stp: false
        forward-delay: 0
      mtu: {{ az.mtu }}

{% endfor %}{% endfor %}


    # 测试网桥配置
    {{ network_config.test_bridge.name }}:
      interfaces: []
      addresses: ["{{ network_config.test_bridge.gateway }}/24"]
      parameters:
        stp: false
        forward-delay: 0
      mtu: {{ network_config.test_bridge.mtu }}
